﻿$(function () {
    var u = Tools.getUser();
    if (!u) {
        $(".m-toolbar-user .tit").attr("href", "/UserLogin/Login").text("亲,请登录");
        $("#upanel").css("visibility", "hidden");
    }
    else {
        window.MyUser = u;
        console.log(MyUser);
        var name = u.petname;
        var remsum = u.remsum;
        var uid = u.uid;
        $(".m-toolbar-user .headimg").attr("src", u.headurl+"?r="+(Math.random()));
        $(".m-toolbar-user .tit").attr("href", "/UserInfo/UserInfo").text(name);
        $(".m-toolbar-user .username").text(name);
        $("#remsum").text(remsum);
        $("#upanel").css("visibility", "visible");
    }

    $("#upanel .quitlogin").click(function () {
        window.location = "/userLogin/login?annul=1";
    });
});